import com.google.gson.Gson;

/**
 * @author yangjiming
 * @create 2021-03-27 16:39
 */
public class JsonStr {
    public static void main(String[] args) {
        String josnStr="{\"age\":22,\"clazz\":\"文科六班\",\"gender\":\"女\",\"id\":\"1500100001\",\"name\":\"施笑槐\"}";
        System.out.println(josnStr);

        Gson gson = new Gson();
        GsonStudent gsonStudent = gson.fromJson(josnStr, GsonStudent.class);
        System.out.println(gsonStudent.getName());

        GsonStudent gsonStudent1 = new GsonStudent("1001", "zs", "25", "一班", "男");
        String s = gson.toJson(gsonStudent1);

        System.out.println(s);
    }
}
